package com.jy.modules.cims.common.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jy.modules.cims.deal.service.DealService;
import com.jy.platform.core.message.DataMsg;

@Controller
public class InteractRestoreController extends CimsBaseController {

	@Autowired
	@Qualifier("com.jy.modules.cims.deal.service.DealService")
	private DealService dealService;

	@RequestMapping("/interactRestore")
	@ResponseBody
	public DataMsg restoreInteract(HttpServletRequest request, HttpServletResponse response, @ModelAttribute DataMsg dataMsg) {
		String businessCode = getParameterString("businessCode");
		dataMsg = initDataMsg(dataMsg);
		
		if (StringUtils.hasText(businessCode)) {
			try {
				dealService.doInteractClassInvokeByBusinessCode(businessCode);
			} catch (Exception e) {
				e.printStackTrace();
				dataMsg.failed(e.getMessage());
			}
		} else {
			dataMsg.failed("业务流水号为空！");
		}
		
		return dataMsg;
	}
}
